package com.webcamtracker.tracker.example;

//import com.webcamtracker.configuration.Configuration;
//import com.webcamtracker.tracker.model.TrackerModel;
//
//import java.awt.*;
//import java.awt.image.BufferedImage;
//import java.util.ArrayList;
//import java.util.List;


//public class MouseTrackerListener{
//    private List<Dimension> history = new ArrayList<Dimension>();
//    private String type = "MOUSELISTENER";
//
//    public void modelNotFound(BufferedImage image) {
//        //To change body of implemented methods use File | Settings | File Templates.
//    }
//
//    public void modelFound(TrackerModel model, BufferedImage image) {
//        double centerX = model.getCenterX();
//        double centerY = model.getCenterY();
//
//        Toolkit toolkit = Toolkit.getDefaultToolkit();
//        Dimension scrnsize = toolkit.getScreenSize();
//        double heigth = scrnsize.getHeight();
//        double width = scrnsize.getWidth();
//        Dimension cameraDimension = Configuration.getInstance().getCameraDimension();
//        int finalY= (int)(((heigth / cameraDimension.getHeight()))*centerY);
//        int finalX= (int)(((width / cameraDimension.getWidth()))*centerX);
//        Robot r;
//        try {
//            r = new Robot();
//            r.mouseMove((int)width-finalX,finalY);
//            if(history.size() > 0){
//                Dimension dimension = history.get(history.size() - 1);
//                double h = dimension.getHeight() / model.getSize().getHeight();
//                double w = dimension.getWidth() / model.getSize().getWidth();
//                if(h>0.1 && w >0.1){
//                    //r.mousePress(InputEvent.BUTTON2_MASK);
//                }
//            }
//
//           // history.add(model.getSize());
//        } catch (AWTException e) {
//            e.printStackTrace();
//        }
//    }
//
//
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//
//        final MouseTrackerListener that = (MouseTrackerListener) o;
//
//        return !(type != null ? !type.equals(that.type) : that.type != null);
//
//    }
//
//    public int hashCode() {
//        return (type != null ? type.hashCode() : 0);
//    }
//}

